package com.example;


import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2016/5/23.
 */
@Transactional
@Repository
public interface UserDao  extends CrudRepository<UserPo,Long> {

    public UserPo findByUserId(long userId);

    public List<UserPo> findAll();

    @Modifying
    @Query("update UserPo u set u.name = ?1 where  u.userId = ?2")
    public int  update(String name, long id);

    public void delete(UserPo id);

    UserPo save(UserPo id);
}
